// eslint-disable-next-line
import { UserLayout, BasicLayout, BlankLayout } from '@/layouts'
// import { bxAnaalyse } from '@/core/icons'

const RouteView = {
  name: 'RouteView',
  render: h => h('router-view')
}

export const asyncRouterMap = [
  {
    path: '/',
    name: 'index',
    component: BasicLayout,
    meta: { title: '首页' },
    redirect: '/product/list',
    children: [
      {
        path: '/product',
        name: 'product',
        redirect: '/product/list',
        component: RouteView,
        meta: { title: '商品管理', keepAlive: true, icon: 'gift' },
        children: [
          {
            path: '/product/list',
            name: 'ProductList',
            component: () => import('@/views/product/List'),
            meta: { title: '商品列表', keepAlive: false }
          },
          {
            path: '/product/detail',
            name: 'ProductDetail',
            hidden:true,
            component: () => import('@/views/product/Detail'),
            meta: { title: '商品详情', keepAlive: false }
          },
        ]
      },
      {
        path: '/order',
        name: 'order',
        redirect: '/order/list',
        component: RouteView,
        meta: { title: '订单管理', keepAlive: true, icon: 'crown' },
        children: [
          {
            path: '/order/list',
            name: 'OrderList',
            component: () => import('@/views/order/List'),
            meta: { title: '订单列表', keepAlive: false }
          },
          {
            path: '/order/photo',
            name: 'OrderPhoto',
            component: () => import('@/views/order/Photo'),
            meta: { title: '下图列表', keepAlive: false }
          },
          {
            path: '/order/prediction',
            name: 'OrderPrediction',
            component: () => import('@/views/order/Prediction'),
            meta: { title: '预报列表', keepAlive: false }
          },
          {
            path: '/order/merge',
            name: 'OrderMerge',
            component: () => import('@/views/order/Merge'),
            meta: { title: '合并预报', keepAlive: false }
          },
          {
            path: '/order/detail',
            name: 'OrderDetail',
            component: () => import('@/views/order/Detail'),
            hidden:true,
            meta: { title: '订单详情', keepAlive: false }
          }
        ]
      },
      {
        path: '/download',
        name: 'Download',
        redirect: '/download/list',
        component: RouteView,
        meta: { title: '下载管理', keepAlive: true, icon: 'download' },
        children:[
          {
            path: '/download/list',
            name: 'DownloadList',
            component: () => import('@/views/order/Download'),
            meta: { title: '下载列表', keepAlive: false }
          }
        ]
      },
      {
        path: '/company',
        name: 'company',
        redirect: '/company/list',
        component: RouteView,
        meta: { title: '企业管理', keepAlive: true, icon: 'bank' },
        children: [
          {
            path: '/company/list',
            name: 'CompanyList',
            component: () => import('@/views/company/List'),
            meta: { title: '企业管理', keepAlive: false }
          },
          {
            path: '/company/client',
            name: 'CompanyClient',
            component: () => import('@/views/company/Client'),
            meta: { title: '客户管理', keepAlive: false }
          },
          {
            path: '/company/staff',
            name: 'CompanyStaff',
            component: () => import('@/views/company/Staff'),
            meta: { title: '员工管理', keepAlive: false }
          },
          {
            path: '/company/skuprice',
            name: 'CompanySkuPrice',
            hidden: true,
            component: () => import('@/views/company/SkuPrice'),
            meta: { title: '一客一品一价', keepAlive: false }
          }
        ]
      },
      {
        path: '/fund',
        name: 'fund',
        redirect: '/fund/list',
        component: RouteView,
        meta: { title: '资金账户', keepAlive: true, icon: 'dollar' },
        children: [
          {
            path: '/fund/list',
            name: 'FundList',
            component: () => import('@/views/fund/List'),
            meta: { title: '账户列表', keepAlive: false },
          },
          {
            path: '/fund/inventory',
            name: 'FundInventory',
            hidden:true,
            component: () => import('@/views/fund/Inventory'),
            meta: { title: '资金明细', keepAlive: false }
          },
        ]
      },
      {
        path: '/logistic',
        name: 'logistic',
        redirect: '/logistic/price',
        component: RouteView,
        meta: { title: '物流管理', keepAlive: true, icon: 'file-done' },
        children: [
          {
            path: '/logistic/price',
            name: 'LogisticPrice',
            component: () => import('@/views/logistic/Price'),
            meta: { title: '物流报价', keepAlive: false },
          },
          {
            path: '/logistic/product',
            name: 'LogisticProduct',
            component: () => import('@/views/logistic/Product'),
            meta: { title: '商品报价', keepAlive: false },
          },
        ]
      },
      {
        path: '/order-new',
        name: 'order-new',
        redirect: '/order-new/price',
        component: RouteView,
        meta: { title: '订单管理new', keepAlive: true, icon: 'file-done' },
        children: [
          {
            path: '/order-new/goods-list',
            name: 'order-goods',
            component: () => import('@/views/order-new/goods/List'),
            meta: { title: '商品列表', keepAlive: false }
          },
          {
            path: '/order-new/purchase',
            name: 'order-purchase',
            component: () => import('@/views/order-new/purchase/List'),
            meta: { title: '采购列表', keepAlive: false },
          }
        ]
      },
      {
        path: '/storage-location',
        name: 'storage-location',
        redirect: '/storage-location/list',
        component: RouteView,
        meta: { title: '库位管理', keepAlive: true, icon: 'file-done' },
        children: [
          {
            path: '/storage-location/list',
            name: 'storage-location-list',
            component: () => import('@/views/storage-location/List'),
            meta: { title: '库位列表', keepAlive: false }
          }
        ]
      },
      {
        path: '/enter-storage',
        name: 'enter-storage',
        redirect: '/enter-storage/list',
        component: RouteView,
        meta: { title: '入库单', keepAlive: true, icon: 'file-done' },
        children: [
          {
            path: '/enter-storage/list',
            name: 'enter-storage-list',
            component: () => import('@/views/enter-storage/List'),
            meta: { title: '入库单列表', keepAlive: false }
          }
        ]
      },
      {
        path: '/leave-storage',
        name: 'leave-storage',
        redirect: '/leave-storage/sortout',
        component: RouteView,
        meta: { title: '出库单', keepAlive: true, icon: 'file-done' },
        children: [
          {
            path: '/leave-storage/sortout',
            name: 'leave-storage-sortout',
            component: () => import('@/views/leave-storage/sortout'),
            meta: { title: '分拣', keepAlive: false }
          }
        ]
      }
      
    ]
  },
  {
    path: '*',
    redirect: '/404',
    hidden: true
  }
]

/**
 * 基础路由
 * @type { *[] }
 */
export const constantRouterMap = [
  {
    path: '/user',
    component: UserLayout,
    redirect: '/user/login',
    hidden: true,
    children: [
      {
        path: 'login',
        name: 'login',
        component: () => import(/* webpackChunkName: "user" */ '@/views/user/Login')
      },
      {
        path: 'recover',
        name: 'recover',
        component: undefined
      }
    ]
  },

  {
    path: '/404',
    component: () => import(/* webpackChunkName: "fail" */ '@/views/exception/404')
  }
]
